package vn.personal.anhht.bloback12.activity;

import vn.personal.anhht.bloback12.util.Constants;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;


public class LogActivity extends TabActivity {


	private TabHost tabHost;
    private Intent intentLogCall;
    private Intent intentLogSMS;
    
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Constants.CHECK_LOG_ACTIVITY = true;
		//LocalizationUtil.setupLanguage(getApplicationContext());
		
		super.onCreate(savedInstanceState);
		

//		tabHost = getTabHost();       
//	    
//	    tabHost.addTab(tabHost.newTabSpec("tab11")
//	              .setIndicator("Log Call",
//	      				getResources().getDrawable(R.drawable.tab_call))
//	              .setContent(new Intent(getApplicationContext(), TabLogCallActivity.class)));
//	      
//	    tabHost.addTab(tabHost.newTabSpec("tab12")
//	              .setIndicator("Log SMS",
//	      				getResources().getDrawable(R.drawable.tab_smslog))
//	              .setContent(new Intent(getApplicationContext(), TabLogSMSActivity.class)));
//	      
//	    tabHost.setCurrentTab(0); 
		setTabs();
		
	}	
	
	/**
     * Sets the tabs.
     */
    private void setTabs() {
        tabHost = getTabHost();
        intentLogCall = new Intent(this, TabLogCallActivity.class);
        intentLogSMS = new Intent(this, TabLogSMSActivity.class);
        addTabs("Log Call", R.drawable.tab_call,
                intentLogCall);
        addTabs("Log SMS", R.drawable.tab_smslog,
                intentLogSMS);
    }

    /**
     * Adds the tabs.
     */
    public void addTabs(String label, int icon, Intent intent) {

        TabHost.TabSpec tabSpec = tabHost.newTabSpec("tab" + label);
        View tabIndicator = LayoutInflater.from(this).inflate(
                R.layout.tab_indocator, getTabWidget(), false);
        TextView title = (TextView) tabIndicator.findViewById(R.id.title);
        title.setText(label);
        ImageView icon1 = (ImageView) tabIndicator.findViewById(R.id.icon);
        icon1.setImageResource(icon);
        tabSpec.setIndicator(tabIndicator);
        tabSpec.setContent(intent);
        tabHost.addTab(tabSpec);
    }
}
